package com.cloud.pole.param.biz;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.PicklistMapper;
import com.cloud.pole.param.model.entity.Picklist;

/**
 * 
* <p>Title: PickListBiz</p>  
* <p>Description: </p>  
* @author hsg  
* @date 2019年1月17日
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class PickListBiz extends BaseBiz<PicklistMapper,Picklist> {

    @Override
    @CacheClear(pre="picklist{1.picklistCode}")
    public void insert(Picklist entity) {
        mapper.insert(entity);
    }

    @Override
    @CacheClear(pre="picklist{1.picklistCode}")
    public void insertSelective(Picklist entity) {
        mapper.insertSelective(entity);
    }
    
    @Override
    @CacheClear(pre="picklist{1.picklistCode}")
    public void updateById(Picklist entity) {
        super.updateById(entity);
    }

    @Override
    @CacheClear(pre="picklist{1.picklistCode}")
    public void updateSelectiveById(Picklist entity) {
        super.updateSelectiveById(entity);
    }
    
    /**
	 * 
	 * <p>Title: selectPicklistByCode</p>  
	 * <p>Description: 根据字典编码查询指定数据字典列表</p>  
	 * @param picklistCode 字典编码
	 * @return 数据字典列表
	 */
    @Cache(key = "picklist{1}")
    public List<Picklist> getPicklistByCode(String picklistCode){
        return mapper.selectPicklistByCode(picklistCode);
    }
    
    public List<Picklist> paramPicklists(){
    	return mapper.selectparamPicklists();
    };
    
    public List<Picklist> pickListTexts(List<String> str){
    	return mapper.selectpickListTexts(str);
    }
    
    public Picklist paramPickBy(String picklistode,String picklistValue) {
    	return mapper.selectByCodeValue(picklistode, picklistValue);
    }
}
